import request from "./request/request";
import {IComponent} from "@bastet/widgets";


interface ISceneResponse {
    data: IComponent[]
    code: number;
}

// 新增
export function addWidget (data: IComponent): Promise<ISceneResponse> {
    return request.post('/widget', data)
}

// 列表
export function getWidgets (): Promise<ISceneResponse> {
    return request.get('/widget/list')
}

// 更新
export function postWidget (data: IComponent) {
    return request.put('/widget', data)
}

// 详情
export function getWidget (id: string) {
    return request.get(`/scene/${id}`)
}

// 删除
export function removeWidget (id: string) {
    return request.delete(`/widget/${id}`)
}